import React,{useState} from 'react';
import {View,Text,Button} from 'react-native';

const Cat = (props) =>{
    const [isHungry,setIsHungry]=useState(true);

    return (
        <View>
            <Text>I am a cat {props.name},and I am {isHungry?"hungry":"full"} </Text>
            <Button
                onPress={()=>{
                    setIsHungry(false);
                }}
                disabled={!isHungry}
                title={isHungry?"Pour me some milk,please!":"Thank you"}
                />
        </View>
    );
}
const Cafe = () =>{
    return <View >
        <Text style={{color:'white',marginLeft:20}}>Welcome</Text>
        <Cat
            name='1'
        />
        <Cat
            name='2'
        />
    </View>
}


export default Cafe;
